package com.ruoyi.project.WebMoudle.terraceDetail.service.impl;

import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.WebMoudle.terraceDetail.mapper.TerraceDetailMapper;
import com.ruoyi.project.WebMoudle.terraceDetail.domain.TerraceDetail;
import com.ruoyi.project.WebMoudle.terraceDetail.service.ITerraceDetailService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 平台账单Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-09-12
 */
@Service
public class TerraceDetailServiceImpl implements ITerraceDetailService 
{
    @Autowired
    private TerraceDetailMapper terraceDetailMapper;

    /**
     * 查询平台账单
     * 
     * @param id 平台账单ID
     * @return 平台账单
     */
    @Override
    public TerraceDetail selectTerraceDetailById(Long id)
    {
        return terraceDetailMapper.selectTerraceDetailById(id);
    }

    /**
     * 查询平台账单列表
     * 
     * @param terraceDetail 平台账单
     * @return 平台账单
     */
    @Override
    public List<TerraceDetail> selectTerraceDetailList(TerraceDetail terraceDetail)
    {
        return terraceDetailMapper.selectTerraceDetailList(terraceDetail);
    }

    /**
     * 新增平台账单
     * 
     * @param terraceDetail 平台账单
     * @return 结果
     */
    @Override
    public int insertTerraceDetail(TerraceDetail terraceDetail)
    {
        terraceDetail.setCreateTime(DateUtils.getNowDate());
        return terraceDetailMapper.insertTerraceDetail(terraceDetail);
    }

    /**
     * 修改平台账单
     * 
     * @param terraceDetail 平台账单
     * @return 结果
     */
    @Override
    public int updateTerraceDetail(TerraceDetail terraceDetail)
    {
        terraceDetail.setUpdateTime(DateUtils.getNowDate());
        return terraceDetailMapper.updateTerraceDetail(terraceDetail);
    }

    /**
     * 删除平台账单对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTerraceDetailByIds(String ids)
    {
        return terraceDetailMapper.deleteTerraceDetailByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除平台账单信息
     * 
     * @param id 平台账单ID
     * @return 结果
     */
    @Override
    public int deleteTerraceDetailById(Long id)
    {
        return terraceDetailMapper.deleteTerraceDetailById(id);
    }

    @Override
    public BigDecimal queryDetailSum(TerraceDetail terraceDetail) {
        return terraceDetailMapper.queryDetailSum(terraceDetail);
    }
}
